<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    new Promise((resolve, reject)=>{
        setTimeout(function (flag,data) {
            if(flag){
                console.log("第一次請求成功")
                resolve(data)
            }else{
                reject("first error")
            }
        },1000,true,"第一次的数据")
    }).then((data)=>{
        return new Promise((resolve, reject)=>{
            setTimeout(function (flag,data,data2) {
                if(flag){
                    console.log("第二次請求成功",data)
                    resolve(data2)
                }else{
                    reject("second error")
                }
            },1000,false,data,"第二次的数据")
        })
    }).then((data)=>{
        return new Promise((resolve, reject)=>{
            setTimeout(function (flag,data,data3) {
                if(flag){
                    console.log("第三次請求成功",data)
                    resolve(data3)
                }
            },1000,true,data,"第三次的数据")
        })
    }).catch((error)=>{
        //处理全流程的异常!!!!
        console.log(error,"+++++")
    })





</script>
</html>